<?php 
class ControllerCommonHeader extends Controller {
	protected function index() {
		$this->data['title'] = $this->document->getTitle(); 
		
		if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
			$this->data['base'] = HTTPS_SERVER;
		} else {
			$this->data['base'] = HTTP_SERVER;
		}
		
		$this->data['description'] = $this->document->getDescription();
		$this->data['keywords'] = $this->document->getKeywords();
		$this->data['links'] = $this->document->getLinks();	
		$this->data['styles'] = $this->document->getStyles();
		$this->data['scripts'] = $this->document->getScripts();
		$this->data['lang'] = $this->language->get('code');
		$this->data['direction'] = $this->language->get('direction');
		
		$this->load->language('common/header');

		$this->data['heading_title'] = $this->language->get('heading_title');
		
		$this->data['text_home'] = $this->language->get('text_home');
		
		$this->data['text_product_store'] = $this->language->get('text_product_store');
		$this->data['text_product'] = $this->language->get('text_product');
		$this->data['text_category'] = $this->language->get('text_category');
		$this->data['text_attribute_group'] = $this->language->get('text_attribute_group');
		$this->data['text_attribute'] = $this->language->get('text_attribute');
		$this->data['text_option'] = $this->language->get('text_option');
		$this->data['text_manufacturer'] = $this->language->get('text_manufacturer');
		$this->data['text_review'] = $this->language->get('text_review');
		
		$this->data['text_order_manager'] = $this->language->get('text_order_manager');
		$this->data['text_order_status'] = $this->language->get('text_order_status');
		$this->data['text_order'] = $this->language->get('text_order');
		$this->data['text_return_reason'] = $this->language->get('text_return_reason');
		$this->data['text_return_status'] = $this->language->get('text_return_status');
		$this->data['text_return'] = $this->language->get('text_return');
		
		$this->data['text_sale'] = $this->language->get('text_sale');
		$this->data['text_advertising'] = $this->language->get('text_advertising');
		$this->data['text_promotion'] = $this->language->get('text_promotion');
		$this->data['text_keyword'] = $this->language->get('text_keyword');
		$this->data['text_coupon_rule'] = $this->language->get('text_coupon_rule');
		$this->data['text_coupon_customer'] = $this->language->get('text_coupon_customer');
		$this->data['text_contact'] = $this->language->get('text_contact');
		
		$this->data['text_customer_manager'] = $this->language->get('text_customer_manager');
		$this->data['text_customer_grade'] = $this->language->get('text_customer_grade');
		$this->data['text_customer'] = $this->language->get('text_customer');
		$this->data['text_customer_blacklist'] = $this->language->get('text_customer_blacklist');

		$this->data['text_netbase'] = $this->language->get('text_netbase');
		$this->data['text_setting'] = $this->language->get('text_setting');
		$this->data['text_layout'] = $this->language->get('text_layout');
		$this->data['text_information'] = $this->language->get('text_information');
		$this->data['text_language'] = $this->language->get('text_language');
		$this->data['text_currency'] = $this->language->get('text_currency');
		$this->data['text_country'] = $this->language->get('text_country');
		$this->data['text_country_zone'] = $this->language->get('text_country_zone');
		$this->data['text_country_city'] = $this->language->get('text_country_city');
		
		$this->data['text_system'] = $this->language->get('text_system');
		$this->data['text_backup'] = $this->language->get('text_backup');
		$this->data['text_export'] = $this->language->get('text_export');
		$this->data['text_user'] = $this->language->get('text_user');
		$this->data['text_user_group'] = $this->language->get('text_user_group');
		$this->data['text_error_log'] = $this->language->get('text_error_log');
		
		$this->data['text_reports'] = $this->language->get('text_reports');
		$this->data['text_report_sale_order'] = $this->language->get('text_report_sale_order');
		$this->data['text_report_sale_shipping'] = $this->language->get('text_report_sale_shipping');
		$this->data['text_report_sale_return'] = $this->language->get('text_report_sale_return');
		$this->data['text_report_sale_coupon'] = $this->language->get('text_report_sale_coupon');
		$this->data['text_report_product_viewed'] = $this->language->get('text_report_product_viewed');
		$this->data['text_report_product_purchased'] = $this->language->get('text_report_product_purchased');
		$this->data['text_report_customer_order'] = $this->language->get('text_report_customer_order');
		$this->data['text_report_customer_credit'] = $this->language->get('text_report_customer_credit');
		
		$this->data['text_extension'] = $this->language->get('text_extension');
		$this->data['text_module'] = $this->language->get('text_module');
		$this->data['text_payment'] = $this->language->get('text_payment');
		$this->data['text_feed'] = $this->language->get('text_feed');
		
		$this->data['text_confirm'] = $this->language->get('text_confirm');
		$this->data['text_front'] = $this->language->get('text_front');
		$this->data['text_logout'] = $this->language->get('text_logout');
		
		if (!$this->user->isLogged() || !isset($this->request->get['token']) || !isset($this->session->data['token']) || ($this->request->get['token'] != $this->session->data['token'])) {
			$this->data['logged'] = '';
			
			$this->data['home'] = $this->url->link('common/login', '', 'SSL');
		} else {
			$this->data['logged'] = sprintf($this->language->get('text_logged'), $this->user->getUserName());
	
			$this->data['home'] = $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL');
			
			$this->data['product'] = $this->url->link('product/product', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['category'] = $this->url->link('product/category', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['attribute_group'] = $this->url->link('product/attribute_group', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['attribute'] = $this->url->link('product/attribute', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['option'] = $this->url->link('product/option', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['manufacturer'] = $this->url->link('product/manufacturer', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['review'] = $this->url->link('product/review', 'token=' . $this->session->data['token'], 'SSL');
			
			$this->data['order_status'] = $this->url->link('order/order_status', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['order'] = $this->url->link('order/order', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['return_reason'] = $this->url->link('order/return_reason', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['return_status'] = $this->url->link('order/return_status', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['return'] = $this->url->link('order/return', 'token=' . $this->session->data['token'], 'SSL');
			
			$this->data['advertising'] = $this->url->link('design/banner', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['promotion'] = $this->url->link('sale/promotion', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['keyword'] = $this->url->link('sale/keyword', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['coupon_rule'] = $this->url->link('sale/coupon_rule', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['coupon_customer'] = $this->url->link('sale/coupon_customer', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['contact'] = $this->url->link('sale/contact', 'token=' . $this->session->data['token'], 'SSL');
			
			$this->data['customer_grade'] = $this->url->link('customer/customer_grade', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['customer'] = $this->url->link('customer/customer', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['customer_blacklist'] = $this->url->link('customer/customer_blacklist', 'token=' . $this->session->data['token'], 'SSL');
			
			$this->data['setting'] = $this->url->link('setting/store', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['layout'] = $this->url->link('design/layout', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['information'] = $this->url->link('product/information', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['language'] = $this->url->link('localisation/language', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['currency'] = $this->url->link('localisation/currency', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['country'] = $this->url->link('localisation/country', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['country_zone'] = $this->url->link('localisation/country_zone', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['country_city'] = $this->url->link('localisation/country_city', 'token=' . $this->session->data['token'], 'SSL');
			
			$this->data['backup'] = $this->url->link('tool/backup', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['export'] = $this->url->link('tool/export', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['user_group'] = $this->url->link('user/user_permission', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['user'] = $this->url->link('user/user', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['error_log'] = $this->url->link('tool/error_log', 'token=' . $this->session->data['token'], 'SSL');
						
			$this->data['report_sale_order'] = $this->url->link('report/sale_order', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['report_sale_shipping'] = $this->url->link('report/sale_shipping', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['report_sale_return'] = $this->url->link('report/sale_return', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['report_sale_coupon'] = $this->url->link('report/sale_coupon', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['report_product_viewed'] = $this->url->link('report/product_viewed', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['report_product_purchased'] = $this->url->link('report/product_purchased', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['report_customer_order'] = $this->url->link('report/customer_order', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['report_customer_credit'] = $this->url->link('report/customer_credit', 'token=' . $this->session->data['token'], 'SSL');
			
			$this->data['module'] = $this->url->link('extension/module', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['payment'] = $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['feed'] = $this->url->link('extension/feed', 'token=' . $this->session->data['token'], 'SSL');

			$this->data['logout'] = $this->url->link('common/logout', 'token=' . $this->session->data['token'], 'SSL');
			$this->data['store'] = HTTP_CATALOG;
			
		}
		
		$this->template = 'common/header.tpl';
		
		$this->render();
	}
}
?>